package net.wanho.systemSettings.service.impl;

import net.wanho.commons.exception.DaoException;
import net.wanho.commons.exception.ServiceException;
import net.wanho.commons.factory.BeanFactory;
import net.wanho.systemSettings.dao.PositionDao;
import net.wanho.systemSettings.po.Position;
import net.wanho.systemSettings.query.PositionQuery;
import net.wanho.systemSettings.service.PositionService;

import java.util.List;

public class PositionServiceImpl  implements PositionService {
    private PositionDao positionDao = BeanFactory.getBean(PositionDao.class) ;
    @Override
    public List<Position> selectByCondPosition(PositionQuery positionQuery) throws ServiceException {
        try {
            return positionDao.selectByCondPosition(positionQuery) ;
        } catch (DaoException e) {
            e.printStackTrace();
            throw new ServiceException(e.getMessage()) ;
        }
    }

    @Override
    public Position selectByIdPosition(Integer positionId) throws ServiceException {
        try {
            return positionDao.selectByIdPosition(positionId) ;
        } catch (DaoException e) {
            e.printStackTrace();
            throw new ServiceException(e.getMessage()) ;
        }
    }
}
